<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head th:include="include :: header"></head>
<body class="hold-transition skin-blue sidebar-mini">

<section class="content-header">
    <h1>工艺卡打印</h1>
</section>
<section class="content">
    <div class="row">
        <div class="col-xs-12">
            <div class="box">
                <div class="box-header">
                    <form id="queryForm" onsubmit="return false;">
                        <div class="row">
                            <div class="form-inline">
                                <div class="form-group">
                                    <label for="query-proCode">项目编号</label>
                                    <input id="query-proCode" type="text" name="proCode" class="form-control"
                                           placeholder="请输入项目编号">
                                </div>
                                <div class="form-group">
                                    <label for="query-proName">项目名称</label>
                                    <input id="query-proName" type="text" name="proName" class="form-control"
                                           placeholder="请输入项目名称">
                                </div>
                                <div class="form-group">
                                    <label for="query-special">类型</label>
                                    <select id="query-special" class="form-control" name="special">
                                        <option value="" selected>请选择</option>
                                        <option th:each="type : ${specials}" th:value="${type.name}"
                                                th:text="${type.name}"></option>
                                    </select>
                                </div>
                                <div class="form-group">
                                    <label for="query-part">部分</label>
                                    <input id="query-part" type="text" name="part" class="form-control"
                                           placeholder="请输入部分">
                                </div>
                                <div class="form-group">
                                    <label for="query-drawNo">图号</label>
                                    <input id="query-drawNo" type="text" name="drawNo" class="form-control"
                                           placeholder="请输入部分">
                                </div>
                                <div class="form-group">
                                    <label for="query-drawName">图名</label>
                                    <input id="query-drawName" type="text" name="drawName" class="form-control"
                                           placeholder="请输入部分">
                                </div>
                                <div class="form-group">
                                    <label for="query-createName">创建人</label>
                                    <input id="query-createName" type="text" name="createNameOne" class="form-control"
                                    placeholder="请输出创建人">
                                </div>
                                <div class="form-group">
                                    <label for="query-status">状态</label>
                                    <select id="query-status" class="form-control" name="status">
                                        <option value="">请选择</option>
                                        <option value="1">待提交</option>
                                        <option value="2">待转定额</option>
                                        <option value="3">待定额提交</option>
                                        <option value="4">待转生产</option>
                                        <option value="5">已转生产</option>
                                    </select>
                                </div>
                                <div class="form-group">
                                    <label for="query-isCheck">校对状态</label>
                                    <select id="query-isCheck" class="form-control" name="isCheck">
                                        <option value="" selected>请选择</option>
                                        <option value="0">未校对</option>
                                        <option value="1">已校对</option>
                                    </select>
                                </div>
                                <div class="form-group">
                                    <label for="query-isQuota">定额状态</label>
                                    <select id="query-isQuota" class="form-control" name="isQuota">
                                        <option value="" selected>请选择</option>
                                        <option value="0">未定额</option>
                                        <option value="1">已定额</option>
                                        <option value="2">不需要</option>
                                    </select>
                                </div>
                                <div class="form-group">
                                    <label for="query-startTime">日期</label>
                                    <input id="query-startTime" type="text" class="form-control datepicker" name="startTime"
                                           readonly="readonly"/>
                                    <label for="query-endTime"> 至 </label>
                                    <input id="query-endTime" type="text" class="form-control datepicker" name="endTime"
                                           readonly="readonly"/>
                                </div>
                                <button type="button" class="btn btn-success" id="btn-search"
                                        onclick="js.table.search(table)">
                                    <span class="Bold">搜索</span>
                                </button>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="box-body">
                    <div id="toolbar" class="form-inline">
                        <a shiro:hasPermission="est:verify:quota" href="javascript:void(0);"
                           class="btn btn-success pull-right" style="margin-right: 10px" onclick="print()">
                            <span class="Bold">批量打印</span>
                        </a>
                    </div>
                    <table id="bootstrap-table" style="font-size: 12px"></table>
                </div>
            </div>
        </div>
    </div>
</section>
<div th:include="include :: footer"></div>
<script th:inline="javascript">

    let table;

    /** 批量转定额 */
    function print() {
        let arr = js.table.selectColumns(table, "id");
        if (arr.length < 1) {
            js.modal.alert("请选择内容");
            return;
        }
        window.open(ctx + 'est/print/p?ids=' + arr)
    }

    $(function () {

        /** 子表 */
        table = js.table.init({
            url: ctx + "est/query/list",
            columns: [
                {
                    checkbox: true
                },
                {
                    title: '序号', field: 'id', width: '50',
                    formatter: function (value, row, index) {
                        return index + 1;
                    }
                },
                {title: "项目编号", field: 'proCode'},
                {title: "项目名称", field: 'proName',width: '190px'},
                {title: "项目数量", field: 'proNum'},
                {title: "类型", field: 'special'},
                {title: "部分", field: 'part',width: '80px'},
                {title: "图号", field: 'drawNo',width:'200px'},
                {title: "图名", field: 'drawName',width:'200px'},
                {title: "状态", field: 'status',
                    formatter: function (value, row) {
                        if (value === 1) {
                            return '<span class="badge label-inverse">待提交</span>';
                        } else if (value === 2) {
                            return '<span class="badge label-warning">待转定额</span>';
                        } else if (value === 3) {
                            return '<span class="badge label-warning">待定额提交</span>';
                        } else if (value === 4) {
                            return '<span class="badge label-warning">待转生产</span>';
                        } else if (value === 5) {
                            return '<span class="badge label-success">已转生产</span>';
                        }
                    }
                },
                {title: "校对", field: 'isCheck',
                    formatter: function (value, row) {
                        if (value === 0) {
                            return '<span class="badge label-default">未校对</span>';
                        } else if (value === 1) {
                            return '<span class="badge label-success">已校对</span>';
                        }
                    }
                },
                {title: "定额", field: 'isQuota',
                    formatter: function (value, row) {
                        if (value === 0) {
                            return '<span class="badge label-default">未定额</span>';
                        } else if (value === 1) {
                            return '<span class="badge label-success">已定额</span>';
                        } else if (value === 2) {
                            return '<span class="badge label-warning">不需要</span>';
                        }
                    }
                },
                {title: "创建人", field: 'createNameOne'},
                {title: "录入日期", field: 'createTime',width: '80px'}
            ]
        });
    });
</script>
</body>
</html>
